package com.jingfu.heefss.handler;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author jingfuu@163.com
 * @version v1.0
 * @date 2020/2/18 16:27
 * @description mvc相关配置
 **/
@Configuration
public class MvcConfig implements WebMvcConfigurer {
    /**
     * 重写接口中的addInterceptors方法，添加自定义拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 通过registry来注册拦截器，通过addPathPatterns来添加拦截路径
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**");
    }
}
